package org.example.reactor;

import reactor.core.publisher.Flux;

import java.util.ArrayList;
import java.util.Arrays;

public class ReactorDemo {
    public static void main(String[] args) {
        String[] array = {"hello", "world", "java"};
        //转换成字母序列并排序
        Flux.fromArray(array).flatMapIterable(item -> Arrays.asList(item.split(""))).distinct().sort().subscribe(System.out::println);
//        Flux.fromArray(array).flatMap(item -> Flux.fromArray(item.split(""))).distinct().sort().subscribe(System.out::println);
//        Flux.fromArray(array)
//                .map(item -> {
//                    String item2 = item.toUpperCase();
//                    return item2;
//                })
//                .subscribe(System.out::println);
    }
}
